package com.example.tangjiangxu.photowalldemo;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.GridView;

public class MainActivity extends Activity {
    private GridView mPhotoWall;

    private PhotoWallAdapter mPhotoWallAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mPhotoWall = (GridView) findViewById(R.id.photo_wall);
        mPhotoWallAdapter = new PhotoWallAdapter(this, 0, ImageUtil.imageUrls, mPhotoWall);
        mPhotoWall.setAdapter(mPhotoWallAdapter);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //退出程序时，取消任务
        mPhotoWallAdapter.cancelAllTasks();
    }
}
